/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package ar.edu.unju.fi.reservahabitaciones.grupo14.struts.spring.servicios;

import org.springframework.beans.BeanInstantiationException;
import org.springframework.beans.BeansException;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

/**
 *
 * @author mauriljb
 */
public class SpringUtil {
      private static ApplicationContext applicationContext;
      static{
          try{
              applicationContext = new ClassPathXmlApplicationContext("applicationContext.xml");
          }catch(Exception e){
              System.out.println(e);
          }
      }
      
      public static ApplicationContext getApplicationContext(){
          return applicationContext;
      }
      
      public static Object getBean (String beanName) throws BeansException, BeanInstantiationException{
          return applicationContext.getBean(beanName);
      }
    
}
